package org.example.design.designmode.builder.buildexercise;

/**
 * 建造者模式
 *  特点： 内部创建私有实例，每个方法对它进行操作并返回
 * @author songyafei
 */

public class CarBuilder {

    private static  Car ca = new Car();
    public CarBuilder addEngine(String engine){
        ca.setEngine(engine);
        return  this;

    }

    public CarBuilder addCarWindow(String carWindow){
        ca.setCarWindow(carWindow);
        return  this;

    }
    public CarBuilder addWheel(String wheel){
        ca.setWheel(wheel);
        return  this;

    }
    public CarBuilder addInterior(String interior){
        ca.setInterior(interior);
        return  this;

    }
    public CarBuilder addAirConditioning(String airConditioning){
        ca.setAirConditioning(airConditioning);
        return  this;

    }

    @Override
    public String toString() {
        return "CarBuilder{" +
                "ca=" + ca +
                '}';
    }
}
